<?php

namespace app\after\model;

use think\Model;
use traits\model\SoftDelete;

class Show extends Model
{
    use SoftDelete;

//链表
    protected $table = 'order';

//    查  询
    public static function show($word)
    {
        if (!empty($word)) {
            $data = self::where('o_order_id', 'like', "%$word%")->paginate(3);
        } else {
            $data = self::paginate(3);
        }
        return $data;
    }

    //    建立软删除
    public static function softDelete($id)
    {
        return self::find($id)->delete();
    }

//    建立回收站
    public static function recycling()
    {
        return self::onlyTrashed()->paginate(3);

    }

    //彻底删除
    public static function deletes($id)
    {
        return self::destroy($id, true);
    }

//    详情
    public static function details($id)
    {
        return self::where('id', $id)->select();
    }

//恢复
    public static function restores($id)
    {
        $obj = new self();
        $obj->restore(['id' => $id]);
    }

}

